package com.project.sianet;

import com.project.sianet.fragment.PrefFragment;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
//import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.text.Html;
import android.view.MenuItem;
 
public class MyPreferenceActivity extends PreferenceActivity {
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
   
		PrefFragment prefFragment = new PrefFragment();
		FragmentManager fragmentManager = getFragmentManager();
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.replace(android.R.id.content, prefFragment);
		fragmentTransaction.commit();
		
		getActionBar().setDisplayHomeAsUpEnabled(true);
		getActionBar().setLogo(R.drawable.ic_notif_launcher);
		getActionBar().setBackgroundDrawable(new ColorDrawable(R.color.orange));
		getActionBar().setDisplayShowTitleEnabled(true);
		getActionBar().setTitle(Html.fromHtml("<font color=\"#ffffff\"><b>" + getString(R.string.app_settings) + "</b></font>"));

	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		
	    switch(item.getItemId()) {
	        case android.R.id.home:
//	        	Intent i = new Intent(this, MainActivity.class);
//				startActivity(i);
//				finish();
	        	onBackPressed();
	            return true;
	    }

	    return super.onOptionsItemSelected(item);
	    
	}
	
}